$def with (rows)

<html lang="en">
<head>
    <title>TMS</title>
</head>
<body>
    <table border=1>
        <tr>
            $for field in rows.next():
                <th>$field</th>
        </tr>
        $for row in rows:
            <tr>
            $for field in row:
                <td>$field</td>
            </tr>
    </table>
</body>
</html>